define(function() {
    return ['$scope','$location', '$interval','$timeout','bizProxy', function($scope,$location,$interval,$timeout,bizProxy) {
    	$scope.$emit("top-show",'true');//显示顶部
    	$scope.$emit('menuTypeLight','mine'); 	//控制底部menu高亮
    	$scope.$emit('bub-menu','true'); 	//隐藏底部menu
    	$scope.$emit('flag-tag','66'); 	//显示底部文字
    	
    	//默认值
    	$scope.userName = "";
    	
    	//点击确认修改
    	$scope.confirm = function(){
			var TestName= $scope.userName.replace(banCode,'')
			//过滤敏感词过滤
			for(var i=0;i<banKeywords.length;i++){
				var _reg=new RegExp(banKeywords[i],'g')
				if(_reg.test(TestName)){
					$scope.userName='';
                    $scope.$emit("promptAlertMsg",'用户名不合法');
                    $scope.$emit("showCollect",true);
                    $timeout(function(){
                        $scope.$emit("showCollect",false);
                    },transData.promptTime);
					return;
				}
			}
    		if(! $scope.userName){
                $scope.$emit("promptAlertMsg",'用户名不能为空');
                $scope.$emit("showCollect",true);
                $timeout(function(){
                    $scope.$emit("showCollect",false);
                },transData.promptTime);
            }else{
            	changeUserName();
            }
    	}
    	
    	//更改用户姓名
    	function changeUserName(){
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;
            
            bizInfo.setupType = "avatar"; //设置用户昵称
            bizInfo.nickName = $scope.userName;
            $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("setupUserInfo", headerInfo,bizInfo,
                    function(tempData){
            			$scope.$emit("loadingChange",false);
                        if(tempData.isSuccess == "T"){
                            $scope.$emit("promptAlertMsg",'修改用户名成功');
                            $scope.$emit("showCollect",true);
                            $timeout(function(){
                                $scope.$emit("showCollect",false);
                            },transData.promptTime);
            				$timeout(function(){
                                resultData.loginResultData.nickName = $scope.userName;
            					$location.path("/changeName").replace();//想改变当前 URL 而不创建新的历史记录的话
            					$scope.$emit('goNext','/accountInfo');
            				},1500);
            				
                        }
                    },
                    function(data){
                    	$scope.$emit("loadingChange",false);
                        $scope.$emit("promptAlertMsg",data.errorMsg);
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                        },transData.promptTime);
        				$timeout(function(){
        					$location.path("/changeName").replace();//想改变当前 URL 而不创建新的历史记录的话
        					$scope.$emit('goNext','/accountInfo');
        				},1500);
                    }
            );
        }
    	
    	$scope.$apply();
    }];
});